<template>
	<div class="page-wrap">
		<div class="page-content p-0">
			<div class="page-column p-0">
				<div class="page-form p-x-0">
					<el-form
						:model="ruleForm"
						:rules="rules"
						label-position="left"
						label-width="154px"
						ref="form"
						label-suffix="："
					>
						<el-row>
							<el-col :span="24">
								<div class="my_title p-b-20">早期死亡效应</div>
								<el-form-item label="早期死亡效应数量" prop="EFNUMEFA001">
									<el-input
										:disabled="this.early_Data.DCF_FILE001=='DOSD60.INP' || this.early_Data.DCF_FILE001=='DOSD825.INP'"
										size="medium"
										class="mediumForm"
										@input="EFNUMEFA001Change"
										v-model.number="ruleForm.EFNUMEFA001"
									></el-input>
								</el-form-item>
								<div class="tablereight">
									<div class="tablecontent">
										<el-table ref="multipleTable" :data="ruleForm.EFATAGRPTab" tooltip-effect="dark" border>
											<el-table-column prop="EFATAGRP_ORG" label="急性器官名称" align="center" min-width="120">
												<template slot-scope="scope">
													<el-form-item
														label-width="0px"
														:rules="rules.EFATAGRP_ORG"
														:prop="'EFATAGRPTab.'+scope.$index+'.EFATAGRP_ORG'"
													>
														<select-para
															style="width:100%"
															size="medium"
															class="bigForm"
															v-model="scope.row.EFATAGRP_ORG"
															:label.sync="scope.row.EFATAGRP_ORGName"
															:options="EFATAGRP_ORGoptions"
														></select-para>
													</el-form-item>
												</template>
											</el-table-column>
											<el-table-column prop="EFATAGRP_ACA" label="ACA参数" align="center" min-width="120">
												<template slot-scope="scope">
													<el-form-item
														label-width="0px"
														:rules="rules.EFATAGRP_ACA"
														:prop="'EFATAGRPTab.'+scope.$index+'.EFATAGRP_ACA'"
													>
														<el-input
															oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
															class="bigForm"
															v-model="scope.row.EFATAGRP_ACA"
														></el-input>
													</el-form-item>
												</template>
											</el-table-column>
											<el-table-column prop="EFATAGRP_ACB" label="ACB参数" min-width="120" align="center">
												<template slot-scope="scope">
													<el-form-item
														label-width="0px"
														:rules="rules.EFATAGRP_ACB"
														:prop="'EFATAGRPTab.'+scope.$index+'.EFATAGRP_ACB'"
													>
														<el-input
															oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
															class="bigForm"
															v-model="scope.row.EFATAGRP_ACB"
														></el-input>
													</el-form-item>
												</template>
											</el-table-column>
											<el-table-column prop="EFATAGRP_THR" label="THR参数" min-width="120" align="center">
												<template slot-scope="scope">
													<el-form-item
														label-width="0px"
														:rules="rules.EFATAGRP_THR"
														:prop="'EFATAGRPTab.'+scope.$index+'.EFATAGRP_THR'"
													>
														<el-input
															oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
															class="bigForm"
															v-model="scope.row.EFATAGRP_THR"
														></el-input>
													</el-form-item>
												</template>
											</el-table-column>
										</el-table>
									</div>
								</div>
							</el-col>
						</el-row>
						<div class="separate m-b-20"></div>
						<el-row>
							<el-col :span="24">
								<div class="my_title p-b-20">早期损伤</div>
								<el-form-item label="早期损伤数量" prop="EINUMEIN001">
									<el-input
										:disabled="this.early_Data.DCF_FILE001=='DOSD60.INP' || this.early_Data.DCF_FILE001=='DOSD825.INP'"
										size="medium"
										class="mediumForm"
										@input="EINUMEIN001Change"
										v-model.number="ruleForm.EINUMEIN001"
									></el-input>
								</el-form-item>
								<div class="tablereight">
									<div class="tablecontent">
										<el-table ref="multipleTable" :data="ruleForm.EINJUGRPTab" tooltip-effect="dark" border>
											<el-table-column prop="EINUMEIN_EI" label="早期损伤类型" align="center" min-width="120">
												<template slot-scope="scope">
													<el-form-item
														label-width="0px"
														:rules="rules.EINUMEIN_EI"
														:prop="'EINJUGRPTab.'+scope.$index+'.EINUMEIN_EI'"
													>
														<select-para
															style="width:100%"
															size="medium"
															class="bigForm"
															v-model="scope.row.EINUMEIN_EI"
															:label.sync="scope.row.EINUMEIN_EIName"
															:options="EINUMEIN_EIoptions"
															@change="EINUMEIN_EIChange(scope.$index)"
														></select-para>
													</el-form-item>
												</template>
											</el-table-column>

											<el-table-column prop="EINJUGRP_ORG" label="器官名称" align="center" min-width="120">
												<template slot-scope="scope">
													<el-form-item
														label-width="0px"
														:rules="rules.EINJUGRP_ORGName"
														:prop="'EINJUGRPTab.'+scope.$index+'.EINJUGRP_ORGName'"
													>
														<el-input class="bigForm" v-model="scope.row.EINJUGRP_ORGName"></el-input>
													</el-form-item>
												</template>
											</el-table-column>
											<el-table-column prop="EINJUGRP_USC" label="EISUSC" align="center" min-width="120">
												<template slot-scope="scope">
													<el-form-item
														label-width="0px"
														:rules="rules.EINJUGRP_USC"
														:prop="'EINJUGRPTab.'+scope.$index+'.EINJUGRP_USC'"
													>
														<el-input
															oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
															class="bigForm"
															v-model="scope.row.EINJUGRP_USC"
														></el-input>
													</el-form-item>
												</template>
											</el-table-column>
											<el-table-column prop="EINJUGRP_HRE" label="EITHRE" min-width="120" align="center">
												<template slot-scope="scope">
													<el-form-item
														label-width="0px"
														:rules="rules.EINJUGRP_HRE"
														:prop="'EINJUGRPTab.'+scope.$index+'.EINJUGRP_HRE'"
													>
														<el-input
															oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
															class="bigForm"
															v-model="scope.row.EINJUGRP_HRE"
														></el-input>
													</el-form-item>
												</template>
											</el-table-column>
											<el-table-column prop="EINJUGRP_ACA" label="EIFACA" min-width="120" align="center">
												<template slot-scope="scope">
													<el-form-item
														label-width="0px"
														:rules="rules.EINJUGRP_ACA"
														:prop="'EINJUGRPTab.'+scope.$index+'.EINJUGRP_ACA'"
													>
														<el-input
															oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
															class="bigForm"
															v-model="scope.row.EINJUGRP_ACA"
														></el-input>
													</el-form-item>
												</template>
											</el-table-column>
											<el-table-column prop="EINJUGRP_ACB" label="EIFACB" min-width="120" align="center">
												<template slot-scope="scope">
													<el-form-item
														label-width="0px"
														:rules="rules.EINJUGRP_ACB"
														:prop="'EINJUGRPTab.'+scope.$index+'.EINJUGRP_ACB'"
													>
														<el-input
															oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
															class="bigForm"
															v-model="scope.row.EINJUGRP_ACB"
														></el-input>
													</el-form-item>
												</template>
											</el-table-column>
										</el-table>
									</div>
								</div>
							</el-col>
						</el-row>
						<div class="separate m-b-20"></div>
						<el-row>
							<el-col :span="24">
								<div class="my_title p-b-20">癌症风险</div>
								<el-form-item label="数量" prop="LCNUMACA001">
									<el-input
										:disabled="this.early_Data.DCF_FILE001=='DOSD60.INP' || this.early_Data.DCF_FILE001=='DOSD825.INP'"
										size="medium"
										class="mediumForm"
										@input="LCNUMACA001Change"
										v-model.number="ruleForm.LCNUMACA001"
									></el-input>
								</el-form-item>
								<div class="tablereight">
									<div class="tablecontent">
										<el-table
											:style="{'margin-bottom':'20px'}"
											ref="multipleTable"
											:data="ruleForm.LCANCERSTab"
											tooltip-effect="dark"
											border
										>
											<el-table-column prop="LCANCERS_AC" label="癌症类型" align="center" min-width="120">
												<template slot-scope="scope">
													<el-form-item
														label-width="0px"
														:rules="rules.EINJUGRP_ACB"
														:prop="'LCANCERSTab.'+scope.$index+'.LCANCERS_AC'"
													>
														<select-para
															style="width:100%"
															size="medium"
															class="bigForm"
															v-model="scope.row.LCANCERS_AC"
															:label.sync="scope.row.LCANCERS_ACName"
															:options="LCANCERS_ACoptions"
															@change="LCANCERS_ACChange(scope.$index)"
														></select-para>
													</el-form-item>
												</template>
											</el-table-column>

											<el-table-column prop="LCANCERS_ORG" label="器官名称" align="center" min-width="120">
												<template slot-scope="scope">
													<el-form-item
														label-width="0px"
														:rules="rules.LCANCERS_ORGName"
														:prop="'LCANCERSTab.'+scope.$index+'.LCANCERS_ORGName'"
													>
														<el-input class="bigForm" v-model="scope.row.LCANCERS_ORGName"></el-input>
													</el-form-item>
												</template>
											</el-table-column>
											<el-table-column prop="LCANCERS_USC" label="ACSUSC" align="center" min-width="120">
												<template slot-scope="scope">
													<el-form-item
														label-width="0px"
														:rules="rules.LCANCERS_USC"
														:prop="'LCANCERSTab.'+scope.$index+'.LCANCERS_USC'"
													>
														<el-input
															oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
															class="bigForm"
															v-model="scope.row.LCANCERS_USC"
														></el-input>
													</el-form-item>
												</template>
											</el-table-column>
											<el-table-column prop="LCANCERS_EFA" label="DOSEFA" min-width="120" align="center">
												<template slot-scope="scope">
													<el-form-item
														label-width="0px"
														:rules="rules.LCANCERS_EFA"
														:prop="'LCANCERSTab.'+scope.$index+'.LCANCERS_EFA'"
													>
														<el-input
															oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
															class="bigForm"
															v-model="scope.row.LCANCERS_EFA"
														></el-input>
													</el-form-item>
												</template>
											</el-table-column>
											<el-table-column prop="LCANCERS_EFB" label="DOSEFB" min-width="120" align="center">
												<template slot-scope="scope">
													<el-form-item
														label-width="0px"
														:rules="rules.LCANCERS_EFB"
														:prop="'LCANCERSTab.'+scope.$index+'.LCANCERS_EFB'"
													>
														<el-input
															oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
															class="bigForm"
															v-model="scope.row.LCANCERS_EFB"
														></el-input>
													</el-form-item>
												</template>
											</el-table-column>
											<el-table-column prop="LCANCERS_CFR" label="CFRISK" min-width="120" align="center">
												<template slot-scope="scope">
													<el-form-item
														label-width="0px"
														:rules="rules.LCANCERS_CFR"
														:prop="'LCANCERSTab.'+scope.$index+'.LCANCERS_CFR'"
													>
														<el-input
															oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
															class="bigForm"
															v-model="scope.row.LCANCERS_CFR"
														></el-input>
													</el-form-item>
												</template>
											</el-table-column>
											<el-table-column prop="LCANCERS_CIR" label="CIRISK" min-width="120" align="center">
												<template slot-scope="scope">
													<el-form-item
														label-width="0px"
														:rules="rules.LCANCERS_CIR"
														:prop="'LCANCERSTab.'+scope.$index+'.LCANCERS_CIR'"
													>
														<el-input
															oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
															class="bigForm"
															v-model="scope.row.LCANCERS_CIR"
														></el-input>
													</el-form-item>
												</template>
											</el-table-column>
											<el-table-column prop="LCANCERS_DDR" label="DDREFA" min-width="120" align="center">
												<template slot-scope="scope">
													<el-form-item
														label-width="0px"
														:rules="rules.LCANCERS_DDR"
														:prop="'LCANCERSTab.'+scope.$index+'.LCANCERS_DDR'"
													>
														<el-input
															oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
															class="bigForm"
															v-model="scope.row.LCANCERS_DDR"
														></el-input>
													</el-form-item>
												</template>
											</el-table-column>
										</el-table>
									</div>
								</div>
								<el-form-item label="最低阈值" prop="LCDDTHRE001">
									<el-input
										size="medium"
										class="mediumForm"
										oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
										v-model="ruleForm.LCDDTHRE001"
									></el-input>
								</el-form-item>
								<el-form-item label="线性剂量阈值" prop="LCACTHRE001">
									<el-input
										size="medium"
										class="mediumForm"
										oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
										v-model="ruleForm.LCACTHRE001"
									></el-input>
								</el-form-item>
							</el-col>
						</el-row>
					</el-form>
				</div>
				<div class="bottom-btn">
					<el-button
						type="primary"
						:disabled="this.basic_Data.OCENDAT1001=='TRUE'"
						:loading="loading"
						@click="submitFun"
					>下一步</el-button>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
import selectPara from "@/components/selectPara"
import commCheckbox from "@/components/commCheckbox"
import ImageCropper from "@/components/ImageCropper"
import FixBottomButton from "@/components/FixBottomButton"
import ueditor from "@/components/ueditor"
import textLength from "@/components/common/comp/textLength"
import { commPara } from "@/mixins/mixins"
import { mapState } from "vuex"
import { SS_ZAOQI_SEARCH, SS_AIZHENG_SEARCH } from "@/service/hd5.js"
import { dome, selecttext, optional } from "@/utils/verify.js"

export default {
	name: "aboutUs",
	props: {
		basicDataF: Object,
	},
	mixins: [commPara],
	components: {
		selectPara,
		ImageCropper,
		textLength,
		commCheckbox,
		FixBottomButton,
		ueditor,
	},

	data() {
		return {
			activeTab: "8",
			DCF_FILE001: "",

			MIORGDEF_ORG: [],
			EZDLTSHLTab: [],

			ruleForm: {
				EFNUMEFA001: "0",
				EINUMEIN001: "0",
				LCNUMACA001: "0",
				EFATAGRPTab: [],
				EINJUGRPTab: [],
				LCANCERSTab: [],
				LCDDTHRE001: "",
				LCACTHRE001: "",
			},
			rules: {
				EFNUMEFA001: [
					{
						validator: optional(0, 5),
						trigger: ["change", "blur"],
					},
				],
				EFATAGRP_ORG: [
					{
						validator: selecttext,
						trigger: ["change", "blur"],
					},
				],
				EFATAGRP_ACA: [
					{
						validator: dome(1.0, 100.0),
						trigger: ["change", "blur"],
					},
				],
				EFATAGRP_ACB: [
					{
						validator: dome(1.0, 100.0),
						trigger: ["change", "blur"],
					},
				],
				EFATAGRP_THR: [
					{
						validator: dome(1.0, 100.0),
						trigger: ["change", "blur"],
					},
				],
				EINUMEIN001: [
					{
						validator: optional(0.0, 10.0),
						trigger: ["change", "blur"],
					},
				],
				EINUMEIN_EI: [
					{
						validator: selecttext,
						trigger: ["change", "blur"],
					},
				],
				EINJUGRP_ORG: [
					{
						validator: selecttext,
						trigger: ["change", "blur"],
					},
				],
				EINJUGRP_USC: [
					{
						validator: dome(0.0, 1.0),
						trigger: ["change", "blur"],
					},
				],
				EINJUGRP_HRE: [
					{
						validator: dome(0.0, 1000.0),
						trigger: ["change", "blur"],
					},
				],
				EINJUGRP_ACA: [
					{
						validator: dome(1.0, 1000.0),
						trigger: ["change", "blur"],
					},
				],
				EINJUGRP_ACB: [
					{
						validator: dome(1.0, 1000.1),
						trigger: ["change", "blur"],
					},
				],
				LCDDTHRE001: [
					{
						validator: dome(0.0, 1.0),
						trigger: ["change", "blur"],
					},
				],
				LCACTHRE001: [
					{
						validator: dome(0.0, 10.0),
						trigger: ["change", "blur"],
					},
				],
				LCANCERS_AC: [
					{
						validator: selecttext,
						trigger: ["change", "blur"],
					},
				],
				LCANCERS_ORG: [
					{
						validator: selecttext,
						trigger: ["change", "blur"],
					},
				],
				LCNUMACA001: [
					{
						validator: optional(0.0, 10.0),
						trigger: ["change", "blur"],
					},
				],
				LCANCERS_USC: [
					{
						validator: dome(0.0, 1.0),
						trigger: ["change", "blur"],
					},
				],
				LCANCERS_EFA: [
					{
						validator: dome(0.0, 2.0),
						trigger: ["change", "blur"],
					},
				],
				LCANCERS_EFB: [
					{
						validator: dome(0.0, 2.1),
						trigger: ["change", "blur"],
					},
				],
				LCANCERS_CFR: [
					{
						validator: dome(0.0, 1.0),
						trigger: ["change", "blur"],
					},
				],
				LCANCERS_CIR: [
					{
						validator: dome(0.0, 1.0),
						trigger: ["change", "blur"],
					},
				],
				LCANCERS_DDR: [
					{
						validator: dome(0.0, 10.0),
						trigger: ["change", "blur"],
					},
				],
				LCDDTHRE001: [
					{
						validator: dome(0.0, 1.0),
						trigger: ["change", "blur"],
					},
				],
				LCACTHRE001: [
					{
						validator: dome(0.0, 10.0),
						trigger: ["change", "blur"],
					},
				],
			},
			TYPE1OUT_NAMoptions: [],
			EINJUGRP_ORGoptions: [],
			LCANCERS_ACoptions: [],
			EFATAGRP_ORGoptions: [],
			EINUMEIN_EIoptions: [],
			loading: false,
			MIORGDEF_ORG1: [],
		}
	},
	computed: {
		...mapState({
			early_Data: (state) => state.token.early_Data,
			basic_Data: (state) => state.token.basic_Data,
		}),
		whetherCount: function () {
			let temp = []
			// console.log(this.early_Data)
			let tempwhetherCount = this.early_Data.MIORGDEF_ORG.map(
				(item, index) => {
					return {
						name: item,
						type: this.early_Data.MIORGDEF_FLG[index],
					}
				}
			)
			tempwhetherCount.forEach((item) => {
				if (item.type == "TRUE") {
					temp.push(item)
				}
			})
			return temp
		},
	},
	mounted() {
		this.getData()
	},
	methods: {
		getData() {
			this.MIORGDEF_ORG = this.$props.basicDataF.MIORGDEF_ORG1

			this.DCF_FILE001 = this.early_Data.DCF_FILE001
			// console.log(this.DCF_FILE001)

			// //早期死亡

			let temp = []

			let tempover = []
			this.whetherCount.forEach((ele, index) => {
				let obj = this.MIORGDEF_ORG.find((i) => i.dic_ename == ele.name)
				if (obj) {
					tempover.push(obj)
				}
			})
			tempover.forEach((item) => {
				// console.log(item.dic_cname.indexOf("急"))
				if (item.dic_cname.indexOf("急") !== -1) {
					temp.push({
						label: item.dic_cname,
						value: item.dic_ename,
					})
				}
			})

			this.EFATAGRP_ORGoptions = temp

			//获取早期损伤数据
			let tempEI = []
			// console.log(this.whetherCount)

			this.whetherCount.forEach((ele, index) => {
				let obj = this.$props.basicDataF.zaoqiList.filter(
					(i) => i.qiguan_ename == ele.name
				)
				if (obj) {
					tempEI = [...tempEI, ...obj]
				}
			})

			this.EINUMEIN_EIoptions = tempEI.map((item) => {
				return {
					label: item.zaoqi_cname,
					value: item.zaoqi_ename,
				}
			})

			//获取癌症数据
			let tempAIZHENG = []
			this.whetherCount.forEach((ele, index) => {
				let obj = this.$props.basicDataF.aiZhengList.filter(
					(i) => i.qiguan_ename == ele.name
				)
				if (obj) {
					tempAIZHENG = [...tempAIZHENG, ...obj]
				}
			})

			this.LCANCERS_ACoptions = tempAIZHENG.map((item) => {
				return {
					label: item.aizheng_cname,
					value: item.aizheng_ename,
				}
			})

			////////回显数据
			//早期死亡
			this.ruleForm.EFNUMEFA001 = this.early_Data.EFNUMEFA001
				? this.early_Data.EFNUMEFA001.toString()
				: "0"
			this.ruleForm.EFATAGRPTab = []
			// console.log(this.early_Data.EFNUMEFA001)
			for (let index = 0; index < this.early_Data.EFNUMEFA001; index++) {
				this.ruleForm.EFATAGRPTab.push({
					EFATAGRP_ORG: this.early_Data.EFATAGRP_ORG[index]
						? this.early_Data.EFATAGRP_ORG[index]
						: "",
					EFATAGRP_ORGName: "",
					EFATAGRP_ACA: this.early_Data.EFATAGRP_ACA[index]
						? this.early_Data.EFATAGRP_ACA[index]
						: "1",
					EFATAGRP_ACB: this.early_Data.EFATAGRP_ACB[index]
						? this.early_Data.EFATAGRP_ACB[index]
						: "1",
					EFATAGRP_THR: this.early_Data.EFATAGRP_THR[index]
						? this.early_Data.EFATAGRP_THR[index]
						: "1",
				})
			}

			//早期损伤
			this.ruleForm.EINUMEIN001 = this.early_Data.EINUMEIN001
				? this.early_Data.EINUMEIN001.toString()
				: "0"
			this.ruleForm.EINJUGRPTab = []
			for (
				let index = 0;
				index < parseInt(this.ruleForm.EINUMEIN001);
				index++
			) {
				this.ruleForm.EINJUGRPTab.push({
					EINUMEIN_EI: this.early_Data.EINUMEIN_EI[index]
						? this.early_Data.EINUMEIN_EI[index]
						: "",
				})
			}
			this.ruleForm.EINJUGRPTab.forEach((i, n) => {
				this.EINUMEIN_EIChange(n)
			})

			//癌症
			this.ruleForm.LCNUMACA001 = this.early_Data.LCNUMACA001
				? this.early_Data.LCNUMACA001.toString()
				: "0"
			this.ruleForm.LCANCERSTab = []
			for (
				let index = 0;
				index < parseInt(this.ruleForm.LCNUMACA001);
				index++
			) {
				this.ruleForm.LCANCERSTab.push({
					LCANCERS_AC: this.early_Data.LCANCERS_AC[index]
						? this.early_Data.LCANCERS_AC[index]
						: "",
				})
			}
			this.ruleForm.LCANCERSTab.forEach((i, n) => {
				this.LCANCERS_ACChange(n)
			})

			//
			this.ruleForm.LCDDTHRE001 = this.early_Data.LCDDTHRE001
				? this.early_Data.LCDDTHRE001
				: "0"
			this.ruleForm.LCACTHRE001 = this.early_Data.LCACTHRE001
				? this.early_Data.LCACTHRE001
				: "0"
		},

		LCNUMACA001Change() {
			this.ruleForm.LCANCERSTab = []
			for (
				let index = 0;
				index < parseInt(this.ruleForm.LCNUMACA001);
				index++
			) {
				this.ruleForm.LCANCERSTab.push({
					LCANCERS_AC: "",
					LCANCERS_ORG: "",
					LCANCERS_ACName: "",
					LCANCERS_ORGName: "",
					LCANCERS_USC: "",
					LCANCERS_EFA: "",
					LCANCERS_EFB: "",
					LCANCERS_CFR: "",
					LCANCERS_CIR: "",
					LCANCERS_DDR: "",
				})
			}
		},
		EINUMEIN001Change() {
			this.ruleForm.EINJUGRPTab = []
			for (
				let index = 0;
				index < parseInt(this.ruleForm.EINUMEIN001);
				index++
			) {
				this.ruleForm.EINJUGRPTab.push({
					EINUMEIN_EI: "",
					EINUMEIN_EIName: "",
					EINJUGRP_ORG: "",
					EINJUGRP_ORGName: "",
					EINJUGRP_USC: "",
					EINJUGRP_HRE: "",
					EINJUGRP_ACA: "",
					EINJUGRP_ACB: "",
				})
			}
		},
		EFNUMEFA001Change() {
			this.ruleForm.EFATAGRPTab = []
			for (let index = 0; index < this.ruleForm.EFNUMEFA001; index++) {
				this.ruleForm.EFATAGRPTab.push({
					EFATAGRP_ORG: "",
					EFATAGRP_ORGName: "",
					EFATAGRP_ACA: "1",
					EFATAGRP_ACB: "1",
					EFATAGRP_THR: "1",
				})
			}
		},
		EINUMEIN_EIChange(index) {
			// console.log(index)
			// console.log(this.$props.basicDataF.zaoqiList)
			let name = this.ruleForm.EINJUGRPTab[index].EINUMEIN_EI
			let obj = this.$props.basicDataF.zaoqiList.find(
				(item) => item.zaoqi_ename == name
			)
			this.ruleForm.EINJUGRPTab[index].EINJUGRP_ORG = obj.qiguan_ename
			this.ruleForm.EINJUGRPTab[index].EINJUGRP_ORGName = obj.qiguan_cname
			this.ruleForm.EINJUGRPTab[
				index
			].EINJUGRP_USC = obj.EISUSC.toString()
			this.ruleForm.EINJUGRPTab[
				index
			].EINJUGRP_HRE = obj.EITHRE.toString()
			this.ruleForm.EINJUGRPTab[
				index
			].EINJUGRP_ACA = obj.EIFACA.toString()
			this.ruleForm.EINJUGRPTab[
				index
			].EINJUGRP_ACB = obj.EIFACB.toString()

			// console.log(obj)
		},
		LCANCERS_ACChange(index) {
			let name = this.ruleForm.LCANCERSTab[index].LCANCERS_AC
			let obj = this.$props.basicDataF.aiZhengList.find(
				(item) => item.aizheng_ename == name
			)
			this.ruleForm.LCANCERSTab[index].LCANCERS_ORG = obj.qiguan_ename
			this.ruleForm.LCANCERSTab[index].LCANCERS_ORGName = obj.qiguan_cname
			this.ruleForm.LCANCERSTab[
				index
			].LCANCERS_USC = obj.ACSUSC.toString()
			this.ruleForm.LCANCERSTab[
				index
			].LCANCERS_EFA = obj.DOSEFA.toString()
			this.ruleForm.LCANCERSTab[
				index
			].LCANCERS_EFB = obj.DOSEFB.toString()
			this.ruleForm.LCANCERSTab[
				index
			].LCANCERS_CFR = obj.CFRISK.toString()
			this.ruleForm.LCANCERSTab[
				index
			].LCANCERS_CIR = obj.CIRISK.toString()
			this.ruleForm.LCANCERSTab[
				index
			].LCANCERS_DDR = obj.DDREFA.toString()

			// console.log(obj)
		},
		submitFun() {
			//保存
			this.$refs.form.validate((valid) => {
				if (valid) {
					// console.log(this.early_Data)
					// console.log(this.ruleForm.EFATAGRPTab)
					// console.log(this.ruleForm.EINJUGRPTab)
					// console.log(this.ruleForm.LCANCERSTab)
					let tempdata = JSON.parse(JSON.stringify(this.early_Data))
					tempdata.EFNUMEFA001 = parseInt(this.ruleForm.EFNUMEFA001)
					if (tempdata.EFNUMEFA001 > 0) {
						tempdata.EFATAGRP_ORG = this.ruleForm.EFATAGRPTab.map(
							(item) => {
								return item.EFATAGRP_ORG
							}
						)
						tempdata.EFATAGRP_ACA = this.ruleForm.EFATAGRPTab.map(
							(item) => {
								return parseFloat(item.EFATAGRP_ACA)
							}
						)
						tempdata.EFATAGRP_ACB = this.ruleForm.EFATAGRPTab.map(
							(item) => {
								return parseFloat(item.EFATAGRP_ACB)
							}
						)
						tempdata.EFATAGRP_THR = this.ruleForm.EFATAGRPTab.map(
							(item) => {
								return parseFloat(item.EFATAGRP_THR)
							}
						)
					} else {
						tempdata.EFATAGRP_ORG = []
						tempdata.EFATAGRP_ACA = []
						tempdata.EFATAGRP_ACB = []
						tempdata.EFATAGRP_THR = []
					}

					tempdata.EINUMEIN001 = parseInt(this.ruleForm.EINUMEIN001)
					if (tempdata.EINUMEIN001 > 0) {
						tempdata.EINUMEIN_EI = this.ruleForm.EINJUGRPTab.map(
							(item) => {
								return item.EINUMEIN_EI
							}
						)
						tempdata.EINJUGRP_ORG = this.ruleForm.EINJUGRPTab.map(
							(item) => {
								return item.EINJUGRP_ORG
							}
						)
						tempdata.EINJUGRP_USC = this.ruleForm.EINJUGRPTab.map(
							(item) => {
								return parseFloat(item.EINJUGRP_USC)
							}
						)
						tempdata.EINJUGRP_HRE = this.ruleForm.EINJUGRPTab.map(
							(item) => {
								return parseFloat(item.EINJUGRP_HRE)
							}
						)
						tempdata.EINJUGRP_ACA = this.ruleForm.EINJUGRPTab.map(
							(item) => {
								return parseFloat(item.EINJUGRP_ACA)
							}
						)
						tempdata.EINJUGRP_ACB = this.ruleForm.EINJUGRPTab.map(
							(item) => {
								return parseFloat(item.EINJUGRP_ACB)
							}
						)
					} else {
						tempdata.EINUMEIN_EI = []
						tempdata.EINJUGRP_ORG = []
						tempdata.EINJUGRP_USC = []
						tempdata.EINJUGRP_HRE = []
						tempdata.EINJUGRP_ACA = []
						tempdata.EINJUGRP_ACB = []
					}

					tempdata.LCNUMACA001 = parseInt(this.ruleForm.LCNUMACA001)
					if (tempdata.LCNUMACA001 > 0) {
						tempdata.LCANCERS_AC = this.ruleForm.LCANCERSTab.map(
							(item) => {
								return item.LCANCERS_AC
							}
						)
						tempdata.LCANCERS_ORG = this.ruleForm.LCANCERSTab.map(
							(item) => {
								return item.LCANCERS_ORG
							}
						)
						tempdata.LCANCERS_USC = this.ruleForm.LCANCERSTab.map(
							(item) => {
								return parseFloat(item.LCANCERS_USC)
							}
						)
						tempdata.LCANCERS_EFA = this.ruleForm.LCANCERSTab.map(
							(item) => {
								return parseFloat(item.LCANCERS_EFA)
							}
						)
						tempdata.LCANCERS_EFB = this.ruleForm.LCANCERSTab.map(
							(item) => {
								return parseFloat(item.LCANCERS_EFB)
							}
						)
						tempdata.LCANCERS_CFR = this.ruleForm.LCANCERSTab.map(
							(item) => {
								return parseFloat(item.LCANCERS_CFR)
							}
						)
						tempdata.LCANCERS_CIR = this.ruleForm.LCANCERSTab.map(
							(item) => {
								return parseFloat(item.LCANCERS_CIR)
							}
						)
						tempdata.LCANCERS_DDR = this.ruleForm.LCANCERSTab.map(
							(item) => {
								return parseFloat(item.LCANCERS_DDR)
							}
						)
					} else {
						tempdata.LCANCERS_AC = []
						tempdata.LCANCERS_ORG = []
						tempdata.LCANCERS_USC = []
						tempdata.LCANCERS_EFA = []
						tempdata.LCANCERS_EFB = []
						tempdata.LCANCERS_CFR = []
						tempdata.LCANCERS_CIR = []
						tempdata.LCANCERS_DDR = []
					}

					tempdata.LCDDTHRE001 = parseFloat(this.ruleForm.LCDDTHRE001)
					tempdata.LCACTHRE001 = parseFloat(this.ruleForm.LCACTHRE001)
					tempdata.SETPAGEINDEX = this.activeTab
					this.$store.dispatch("upData_early_Data", tempdata)
					// console.log(this.early_Data)
					let params = {
						batchid: this.$route.query.id,
						batchinfo: "ZAOQI",
						submitjson: JSON.stringify(tempdata),
					} 
					this.$appApi
						.BATCH_SUBMIT(params)
						.then((res) => { 
							var str = res.data.substring(0, 1)
							if (str == "E") {
								let message = res.data.substring(6)
								this.$notify.error({
									title: "保存失败！",
									message: message,
									type: "success",
								})
							} else if (str == "S") {
								this.$notify({
									message: "保存成功！",
									type: "success",
								})
							}
						})
						.catch((err) => {
							console.log(err)
						})
					this.$emit("changeActiveTab", this.activeTab)
					this.$store.dispatch("change_early_showTab", this.activeTab)
				}
			})
		},
		daochu() {
			//导出
		},
	},
}
</script>
<style lang="scss" scoped>
.page-flex-row /deep/ .el-collapse-item__header {
	background: #f3f9fe;
}
.operation {
	width: 95%;
	height: 80px;
	display: flex;
	justify-content: flex-end;
	align-items: center;
}
#img-upload {
	display: none;
}
</style>